load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "server",
    srcs = [
        "api_server.go",
        "defaults.go",
        "determined.go",
        "infra_driver.go",
        "kube_driver.go",
        "kube_event_tail.go",
        "master.go",
        "monitor.go",
        "pipeline_controller.go",
        "pipeline_state_driver.go",
        "poller.go",
        "s3g_sidecar.go",
        "server.go",
        "transaction_defer.go",
        "worker.go",
        "worker_rc.go",
    ],
    importpath = "github.com/pachyderm/pachyderm/v2/src/server/pps/server",
    visibility = ["//visibility:public"],
    deps = [
        "//src/auth",
        "//src/internal/ancestry",
        "//src/internal/backoff",
        "//src/internal/client",
        "//src/internal/collection",
        "//src/internal/config",
        "//src/internal/cronutil",
        "//src/internal/determined",
        "//src/internal/dlock",
        "//src/internal/errors",
        "//src/internal/errutil",
        "//src/internal/grpcutil",
        "//src/internal/limit",
        "//src/internal/log",
        "//src/internal/lokiutil",
        "//src/internal/lokiutil/client",
        "//src/internal/metrics",
        "//src/internal/middleware/auth",
        "//src/internal/miscutil",
        "//src/internal/pachconfig",
        "//src/internal/pachsql",
        "//src/internal/pachtmpl",
        "//src/internal/pctx",
        "//src/internal/pfsdb",
        "//src/internal/pfsfile",
        "//src/internal/ppsdb",
        "//src/internal/ppsload",
        "//src/internal/ppsutil",
        "//src/internal/serde",
        "//src/internal/task",
        "//src/internal/tracing",
        "//src/internal/tracing/extended",
        "//src/internal/transactionenv",
        "//src/internal/transactionenv/txncontext",
        "//src/internal/uuid",
        "//src/internal/watch",
        "//src/pfs",
        "//src/pps",
        "//src/server/auth",
        "//src/server/pfs",
        "//src/server/pfs/pretty",
        "//src/server/pfs/s3",
        "//src/server/pps",
        "//src/server/worker/common",
        "//src/server/worker/datum",
        "//src/server/worker/driver",
        "//src/server/worker/pipeline/transform",
        "//src/server/worker/server",
        "//src/server/worker/stats",
        "//src/task",
        "//src/version",
        "@com_github_determined_ai_determined_proto//pkg/apiv1",
        "@com_github_determined_ai_determined_proto//pkg/rbacv1",
        "@com_github_determined_ai_determined_proto//pkg/userv1",
        "@com_github_determined_ai_determined_proto//pkg/workspacev1",
        "@com_github_evanphx_json_patch//:json-patch",
        "@com_github_itchyny_gojq//:gojq",
        "@com_github_opentracing_opentracing_go//:opentracing-go",
        "@com_github_prometheus_client_golang//prometheus",
        "@com_github_prometheus_client_golang//prometheus/promauto",
        "@io_etcd_go_etcd_client_v3//:client",
        "@io_k8s_api//core/v1:core",
        "@io_k8s_apimachinery//pkg/api/errors",
        "@io_k8s_apimachinery//pkg/api/resource",
        "@io_k8s_apimachinery//pkg/apis/meta/v1:meta",
        "@io_k8s_apimachinery//pkg/fields",
        "@io_k8s_apimachinery//pkg/labels",
        "@io_k8s_apimachinery//pkg/util/intstr",
        "@io_k8s_apimachinery//pkg/watch",
        "@io_k8s_client_go//kubernetes",
        "@io_k8s_client_go//kubernetes/typed/core/v1:core",
        "@io_k8s_client_go//tools/cache",
        "@io_k8s_utils//ptr",
        "@org_golang_google_genproto_googleapis_rpc//errdetails",
        "@org_golang_google_grpc//codes",
        "@org_golang_google_grpc//metadata",
        "@org_golang_google_grpc//status",
        "@org_golang_google_protobuf//encoding/protojson",
        "@org_golang_google_protobuf//proto",
        "@org_golang_google_protobuf//reflect/protoreflect",
        "@org_golang_google_protobuf//types/known/emptypb",
        "@org_golang_google_protobuf//types/known/timestamppb",
        "@org_golang_google_protobuf//types/known/wrapperspb",
        "@org_golang_x_sync//errgroup",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)

go_test(
    name = "server_test",
    srcs = [
        "api_server_test.go",
        "defaults_test.go",
        "internal_test.go",
        "merge_test.go",
        "parallelism_test.go",
        "pipeline_controller_test.go",
        "worker_rc_test.go",
    ],
    embed = [":server"],
    pure = "on",
    shard_count = 4,
    deps = [
        "//src/auth",
        "//src/internal/ancestry",
        "//src/internal/backoff",
        "//src/internal/client",
        "//src/internal/config",
        "//src/internal/dockertestenv",
        "//src/internal/errors",
        "//src/internal/grpcutil",
        "//src/internal/pachconfig",
        "//src/internal/pachd",
        "//src/internal/pctx",
        "//src/internal/ppsutil",
        "//src/internal/require",
        "//src/internal/stream",
        "//src/internal/task",
        "//src/internal/testpachd",
        "//src/internal/testpachd/realenv",
        "//src/internal/testutil",
        "//src/internal/uuid",
        "//src/internal/watch",
        "//src/pfs",
        "//src/pps",
        "//src/server/auth/server/testing",
        "//src/server/worker/datum",
        "@com_github_google_go_cmp//cmp",
        "@io_k8s_api//core/v1:core",
        "@io_k8s_apimachinery//pkg/api/resource",
        "@io_k8s_apimachinery//pkg/apis/meta/v1:meta",
        "@io_k8s_client_go//kubernetes/fake",
        "@io_k8s_utils//ptr",
        "@org_golang_google_grpc//codes",
        "@org_golang_google_grpc//status",
        "@org_golang_google_protobuf//encoding/protojson",
        "@org_golang_google_protobuf//proto",
        "@org_golang_google_protobuf//types/known/durationpb",
        "@org_golang_google_protobuf//types/known/timestamppb",
        "@org_golang_google_protobuf//types/known/wrapperspb",
    ],
)
